import { defineStore } from "pinia";
import loginAPI from "../api/login";
export const useLoginStore = defineStore("login", {
  actions: {
    Login(data) {
      return loginAPI.login(data).then((res) => {
        uni.setStorageSync("assecss_token", res.access);
        uni.setStorageSync("userinfo", res);
      });
    },
    LoginOut() {
      return new Promise((response) => {
        uni.removeStorageSync("assecss_token");
        uni.removeStorageSync("userinfo");
        response();
      });
    },
  },
});
